package com.eastfair.auth.service;

import com.eastfair.auth.dto.OrganizationSaveDTO;
import com.eastfair.auth.dto.ResourceOrganizationSaveDTO;
import com.eastfair.auth.vo.ResourceOrganizationVo;
import com.eastfair.boot.service.SuperCacheService;
import com.eastfair.auth.entity.ResourceOrganization;
import com.eastfair.core.base.R;

import java.util.List;

/**
 * <p>
 * 业务接口
 * 
 * </p>
 *
 * @author ligang
 * @date 2021-07-19
 */
public interface ResourceOrganizationService extends SuperCacheService<ResourceOrganization> {
    /**
     * 创建资源
     *
     * @param resourceOrganizationSaveDTO 组织资源信息
     * @return
     */
    R createResource(ResourceOrganizationSaveDTO resourceOrganizationSaveDTO);

    /**
     * 删除资源
     *
     * @param resourceId 资源id
     * @return
     */
    R delResource(Long resourceId);

    /**
     * 查询资源相关的组织
     *
     * @param resourceId 资源id
     * @return
     */
    List<ResourceOrganization> findResource(Long resourceId);

    /**
     * 查询资源相关的组织
     *
     * @param resourceIdList 资源id集合
     * @return
     */
    List<ResourceOrganization> findResourceList(List<Long> resourceIdList);
    /**
     * 更新资源
     *
     * @param organizationSaveDTO         组织信息
     * @param resourceOrganizationSaveDTO 组织资源信息
     * @return
     */
    R updResource(OrganizationSaveDTO organizationSaveDTO, ResourceOrganizationSaveDTO resourceOrganizationSaveDTO);


    /**
     * 查询资源
     * @param resourceOrganization 资源信息
     * @param orgIds  组织id集合
     * @param ids  主键id集合
     * @return
     */
    List<ResourceOrganization> queryResources(ResourceOrganization resourceOrganization,List<Long> orgIds,List<Long> ids);


    /**
     * 通过组织查询资源
     * @param orgIds 组织id集合
     * @return
     */
    List<ResourceOrganizationVo> queryResource(List<Long> orgIds);

    /**
     * 删除
     * @param id 主键id
     * @return
     */
    R del(Long id);

    /**
     * 删除 跟组织的关联关系
     * @param orgIds 组织id集合
     * @return
     */
    R delOfOrgIds(List<Long> orgIds);

    /**
     * 内部查询
     * @param resourceOrganization
     * @param orgIds
     * @param ids
     * @return
     */
    List<ResourceOrganization> listOfResourceOrganization(ResourceOrganization resourceOrganization, List<Long> orgIds, List<Long> ids);
    /**
     * 内部查询
     * @param resourceOrganization
     * @param orgIds
     * @param ids
     * @return
     */
    List<ResourceOrganization> listOfResourceOrganizationOfCache(ResourceOrganization resourceOrganization, List<Long> orgIds, List<Long> ids);


    /**
     * 组装  通过节点查询所关联的资源，在通过资源查询所有关联的节点，最后拿到所有节点的角色
     *
     * @param orgIds 节点id集合
     * @return
     */
    List<ResourceOrganization> assembleOrgOfresource(List<Long> orgIds);


}
